package com.suse.jd_system_server.dao;

import com.suse.jd_system_server.entity.Hotel;
import com.suse.jd_system_server.entity.HotelData;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

/**
 * 数据库初始化接口，用于为数据库表提供数据
 */
@Mapper
public interface DatasourceInitDao {
    @Insert("insert into hotel(hotel_name,hotel_star,addx,addy,country,province,city,region,addr,is_parking,telphone,description,area) " +
            "values(#{hotelName},#{hotelStar},#{addx}," +
            "#{addy},#{country},#{province},#{city},#{region},#{addr},#{isParking},#{telphone}," +
            "#{description},#{area})")
    void hotelInsert(HotelData hotelData);

    @Insert("insert into img(img_url,is_hotel) values(#{url},#{code})")
    void imgInsert(String url,Integer code);

    @Update("UPDATE hotel set ${str1} = #{value} WHERE ${str2} = #{condition}")
    <T>void setSingleColumnBySingleCondition(String str1,String str2,T value,T condition);
}
